home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nannws31.zip / CURDRV.ASM next >
Assembly Source File  |  1988-08-09  |  2KB  |  58 lines

  1. INCLUDE EXTENDA.INC
  2.  
  3. ;-------------------------------------------------------;
  4. ; Function: CURDRV                                      ;
  5. ; Author:   Grant Nesheim                               ;
  6. ; Copyright (c) 1988 Nantucket Corp.                    ;
  7. ;                                                       ;
  8. ; Purpose:  To return the letter of the currently       ;
  9. ;           selected default drive. If a DOS error      ;
  10. ;           occurs during execution, CURDRV returns     ;
  11. ;           a null string.                              ;
  12. ;-------------------------------------------------------;
  13.  
  14. CODESEG CURDRV
  15. DATASEG
  16.  
  17. CLpublic <CURDRV>
  18.  
  19. ; Initialize data storage and constants
  20. ;    DBUFF = one character string to store the drive
  21. ;        letter or zero in.
  22. ;    DRIVE = address of DBUFF.
  23.  
  24. CLstatic <string DBUFF " ", cptr DRIVE DBUFF> 
  25.  
  26. CLfunc char CURDRV
  27. CLcode
  28.  
  29.      ; Call DOS interrupt 21h function number 19h to
  30.      ; get the current drive number.  On exit of the 
  31.      ; interrupt al contains the number 0-25 and the
  32.      ; carry flag will be set if an error occurs or
  33.      ; cleared if no errors.
  34.  
  35.      DOSREQ  19h
  36.      JNC     NOERR
  37.     
  38.      ; The carry flag was set.  Move a zero, null,
  39.      ; into the return string.
  40.      
  41.      MOV  DBUFF, 0
  42.      JMP  CDRET
  43.  
  44. NOERR:
  45.      ; Add 65 to the al register to get a drive letter
  46.      ; and move it into the return string.
  47.     
  48.      ADD    al,65
  49.      MOV    DBUFF, al
  50.  
  51. CDRET:
  52.      ; Return the result string
  53.     
  54.      CLret DRIVE  
  55.  
  56.           END
  57.  
  58.